﻿using System.IO;
using FiddlerAmfParser.OutputProcessing;
using StructureMap.Configuration.DSL;

namespace FiddlerAmfParser
{
	public class PluginRegistry : Registry
	{
		public PluginRegistry()
		{
			// Register default output processor engine.
			For<IOutputProcessorPlugin>().Add<DefaultOutputProcessor>();
			
			// Register fiddler script output processor.
			For<IOutputProcessorPlugin>().Add<FiddlerScriptOutputProcessor>();

			// Register scanner for additional .dll's containing a processor plugin.
			Scan(x =>
				{
					x.AssembliesFromPath(Path.GetDirectoryName(typeof(DefaultOutputProcessor).Assembly.Location));
					x.AddAllTypesOf<IOutputProcessorPlugin>();
					x.WithDefaultConventions();
				});
		}
	}
}
